package com.xique.park.api.factory;


import com.xique.common.core.web.domain.AjaxResult;
import com.xique.park.api.RemoteParkGarageLaneDeviceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 日志服务降级处理
 *
 * @author xique
 */
@Component
public class RemoteParkGarageLaneDeviceFallbackFactory implements FallbackFactory<RemoteParkGarageLaneDeviceService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteParkGarageLaneDeviceFallbackFactory.class);

    @Override
    public RemoteParkGarageLaneDeviceService create(Throwable throwable)
    {
        log.error("服务调用失败:{}", throwable.getMessage());
        return new RemoteParkGarageLaneDeviceService()
        {

            @Override
            public AjaxResult deleteDevices(Long parkId) {
                return AjaxResult.error("删除相机失败:" + throwable.getMessage());
            }
        };

    }
}
